import api from '@/http/index'

class Api {
    /* 获取表格列表 */
    static getTablesList(data) {
        return new Promise((resolve, reject) => {
            api.get('/api/Dictionary/GetNewsTypeGridJson?parentid=6', data)
                .then(res => {
                    resolve(res)
                })
                .catch(err => {
                    reject(err)
                })
        })
    }
    /* 新建 */
    static addTablesItem(data) {
        return new Promise((resolve, reject) => {
            api.post('/api/Dictionary/SubmitForm', data)
                .then(res => {
                    resolve(res)
                })
                .catch(err => {
                    reject(err)
                })
        })
    }
    /* 停用启用 */
    static setDisableEnable(data) {
        return new Promise((resolve, reject) => {
            api.post('/api/DTDService/Switch', data)
                .then(res => {
                    resolve(res)
                })
                .catch(err => {
                    reject(err)
                })
        })
    }
    /* 删除 */
    static deleteItem(data) {
        return new Promise((resolve, reject) => {
            api.get('/api/Dictionary/DeleteForm', data)
                .then(res => {
                    resolve(res)
                })
                .catch(err => {
                    reject(err)
                })
        })
    }
    static recoverForm(data) {
        return new Promise((resolve, reject) => {
            api.get('/api/Dictionary/RecoverForm', data)
                .then(res => {
                    resolve(res)
                })
                .catch(err => {
                    reject(err)
                })
        })
    }
    /* 根据id获取信息 */
    static getItemInfo(data) {
        return new Promise((resolve, reject) => {
            api.get('/api/Dictionary/GetFormJson', data)
                .then(res => {
                    resolve(res)
                })
                .catch(err => {
                    reject(err)
                })
        })
    }
}

export default Api
